const fs = require("fs");
const path = require('path');

//var data = fs.readFileSync("range.js", {encoding:'utf8', flag:'r'});
//console.log(data);

//fs.readFile("range1.js", {encoding:'utf8', flag:"r"}, (err, data)=>{
	//if(err)
		//throw err;
	//console.log(data);
//});

//console.log("--------------__filename", __filename);
//console.log("--------------__dirname", __dirname);
//console.log(process.argv)
//process.on("exit", (code)=>{
	//console.log("----------------------xzcv",code);
//});

//process.argv.forEach((val, index, array)=> {
    //console.log(val, index);
    //console.log('array->', array);
//}
            //);

function getSubdirLists(dirname) {
    var stat = fs.statSync(dirname)
    if (!stat || !stat.isDirectory()) {
        return [];
    }

    var subDirs = []
    var dirs = fs.readdirSync('.');
    dirs.forEach((item, idx) => {
        subDir = path.join(dirname, item)
        stat = fs.statSync(subDir)
        if (stat && stat.isDirectory()) {
            subDirs.push(subDir)
        }
    })

    console.log(subDirs)
}

getSubdirLists('.')
//path.basename('./file')
